package com.twu.biblioteca;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * User: akerber
 * Date: 1/24/13
 * Time: 2:19 PM
 */
public class BookCatalog {
    ArrayList<Book> catalog;

    public BookCatalog(){
        catalog = new ArrayList<Book>();
    }

    public void addBook(Book book){
        catalog.add(book);
    }

    public boolean reserve(Book book){
        return this.isBookOnCatalog(book);
    }


    public boolean isBookOnCatalog(Book book){
        if(catalog.contains(book)){
            return true;
        } else return false;

    }

    public void showAllBooks() {
        Iterator<Book> it=null;
        for(it=catalog.iterator();it.hasNext();)
        {
            System.out.println(it.next().name);
        }
    }
}
